import requests


# 使用request获取百度中搜索到的python相关的数据
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
}

# url = 'https://www.baidu.com/s?wd=python'
# response = requests.get(url, headers=headers)
# print(response.text)

# 创建查询字符串参数
kw = {
    'wd': 'python'
}

# requests模块会自动添加？
response = requests.get('http://www.baidu.com/s', headers=headers, params=kw)
response.encoding = 'utf-8'
print(response.text)

